<template>
  <div>
    <h3>主页面</h3>
    {{ kind_list }}
    <table style="width:1000px;margin:0 auto">
        <tr>
            <th>编号</th>
            <th>种类</th>
        </tr>
        <tr v-for="(item,i) in kind_list" :key="i">
            <td>{{ item.id }}</td>
            <td>
                <router-link :to="({name: 'Goods',params:{id:item.id}})"> {{ item.kind }}</router-link>
               
            </td>
            

            
               
        </tr>
    </table>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            kind_list:[]
        }
    },
    mounted(){
        this.getkind()
    },
    methods:{
        getkind(){
            axios.get('http://127.0.0.1:8000/users/kind/')
            .then(resp=>{
                console.log(resp);
                this.kind_list=resp.data

            })
            .catch(err=>{
                console.log(err);
            })
        }
    }
}
</script>

<style>

</style>